package com.own.business.question.mapper;

import com.own.business.question.entity.map.QuestionMapVo;
import com.own.business.question.entity.po.Question;
import com.own.business.question.entity.query.QuestionQuery;
import com.own.business.question.entity.vo.QuestionVo;
import com.own.component.common.base.mapper.BasePageMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * QuestionMapper
 *
 * @author chenxueli
 * @date 2021/05/14 09:41:05
 */
@Mapper
public interface QuestionMapper extends BasePageMapper<
        Question,
        QuestionVo,
        QuestionMapVo,
        QuestionQuery
        > {

    /**
     * 添加总数
     *
     * @param id 题目id
     * @return 影响行数
     */
    default int addTotal(@Param("id") Long id) {
        return addTotalNumber(id, 1);
    }

    /**
     * 添加总数
     *
     * @param id     题目id
     * @param number 添加的数量
     * @return 影响行数
     */
    int addTotalNumber(@Param("id") Long id, @Param("number") Integer number);

    /**
     * 批量添加总数
     *
     * @param list 题目idList
     * @return
     */
    int batchAddTotal(@Param("list") List<Long> list);

}
